﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DotNET4Study
{
    class ReflectStudy
    {
        public static void Execute()
        {
            Type classType = Type.GetType("DotNET4Study.MyStudent,DotNET4Study");
            List<object> paraList = new List<object>();
            paraList.Add("xieran");
            paraList.Add(30);
            object[] objArray = paraList.ToArray();
            MyStudent dal = Activator.CreateInstance(classType, objArray) as MyStudent;
            Console.WriteLine( dal.ToString());

            Type type= dal.GetType();
            Console.WriteLine("FullName:{0};Name:{1};AssName:{2}", type.FullName,type.Name,type.AssemblyQualifiedName);
        }
    }

    public class MyStudent
    { 
        public MyStudent(string name ,int age)
        {
            this.Age = age;
            this.Name = name;
        }

        public string Name { set; get; }
        public int Age { get; set; }

        public override string ToString()
        {
            return string.Format("姓名{0}；年龄{1}",Name,Age);
        }
    }
}
